﻿@model PagedList<WordsModel>
@using MyBlog
@if (Model.Count == 0)
{
    if (UserSession.LoginUserInfo != null && UserSession.LoginUserInfo.IsAdmin)
    {
        <span class="dv-none-tip">Hi，管理员！你可以猛戳右边的按钮发表本页面的动态哦^_^</span>
    }
    else
    {
        <div class="dv-none-tip">暂时还没有管理员发表言论~</div>
    }
}
else
{
    int i = 0;
    foreach (var item in Model)
    {
        i++;
        <div id="m-@item.ID" class="dv-word-top-head">
            <div class="dv-word-top-head-left">
                <a title="管理员：@(item.Account.NickName)" href="@Url.Action("index", "blog", new { username = item.UserID })">
                    @if (item.Account.HeadId.HasValue && item.Account.HeadId.Value > 0)
                    {
                        <img class="imghead75" src="@Url.Action("GetUserHeadByUid","account", new {uid= item.UserID })" />
                    }
                    else
                    {
                        <img class="imghead75" src="~/Content/Images/zanwutouxiang.jpg" />
                    }
                </a>
            </div>
            <div class="arrow_box">
                <div class="m-content">
                    @Html.Raw(item.Content.HtmlDecode())
                </div>
                <div class="dv-word-com-op">
                    <span>【管理员】<label class="spuid">@(item.Account.NickName)</label>发表于 @item.CreateTime.ToString("yyyy-MM-dd HH:mm")</span>
                    <span>
                        <a href="javascript:;" onclick="agree(@item.ID,@item.AgreeCount,this)"><i class="icon-heart"></i> 赞(@item.AgreeCount)</a>
                    </span>
                    <span>
                        <a href="javascript:;" onclick="setTxtFocus(@item.ID)"><i class="icon-comments"></i> 评论(@item.WordComments.Count)</a>
                    </span>
                    @if (UserSession.LoginUserInfo != null && UserSession.LoginUserInfo.IsAdmin)
                    {
                        @:&nbsp; <a href="javascript:;" class="edit" onclick="showSendView(@item.ID)">[编辑]</a>
                        @:&nbsp; <a href="javascript:;" class="edit" onclick="deleteWord(@item.ID)">[删除]</a>
                    }
                </div>
                <div class="@(i%2!=0?"arrowtip":"arrowtip")"></div>
                <hr id="hr-@item.ID" />
                @if (item.WordComments.Count > 0)
                {
                    foreach (var c in item.WordComments)
                    {
                        <div class="dv-word-com-main">
                            <div class="dv-word-com-main-header">
                                <a href="@Url.Content("~/" + c.CommentUID)">
                                    @if (item.Account.HeadId.HasValue && item.Account.HeadId.Value > 0)
                                    {
                                        <img class="imghead55" src="@Url.Action("GetUserHeadByUid","account", new {uid= c.CommentUID })" />
                                    }
                                    else
                                    {
                                        <img class="imghead55" src="~/Content/Images/zanwutouxiang.jpg" />
                                    }
                                </a>
                            </div>
                            <div class="dv-word-com-main-body">
                                <div class="dv-word-com-main-body-header">
                                    <span>
                                        <span class="spuid">@WebCache.GetNickName(c.CommentUID) </span>&nbsp;
                                        <span class="sptime">@c.CommentTime.ToString("yyyy-MM-dd HH:mm")</span>
                                    </span><br />
                                    <span class="spcontent">@HttpUtility.HtmlEncode(c.Content)</span>
                                </div>
                                <div class="dv-word-com-main-body-footer">
                                    <span>
                                        <a href="javascript:;" onclick="setTxtFocus(@c.WID,'@WebCache.GetNickName(c.CommentUID)')"><i class="icon-reply"></i> 回复</a>
                                    </span>
                                    <span>
                                        <a href="javascript:;" onclick="agreeReply(@c.ID,@c.AgreeCount,this)"><i class="icon-heart"></i> 赞(@c.AgreeCount)</a>
                                    </span>
                                    @if (UserSession.LoginUserInfo != null && UserSession.LoginUserInfo.IsAdmin)
                                    {
                                        <span>
                                            <a href="javascript:;" onclick="delComment(@c.ID)"><i class="icon-remove"></i> 删除</a>
                                        </span>
                                    }
                                </div>
                            </div>
                        </div>
                    }
                }
                <div class="dv-word-com-tarea-main">
                    <textarea class="dv-word-com-tarea-main-txt" id="tarea-@item.ID" onfocus="changeHeight(this)" onblur="changeBack(this)" maxlength="250" placeholder="我来说一句……"></textarea>
                    <span class="dv-word-com-tarea-main-span"><input type="button" value="提交" class="btnNormal" onclick="sendComment(@item.ID)" /></span>
                </div>
            </div>
        </div>
    }
}
<input type="hidden" id="hTotal" value="@Model.TotalItemCount" />